/**
 * 
 */
package com.mobile2you.nci.android.domain;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author JBromo
 * 
 */
public class AnnuaireGroup implements Comparable<AnnuaireGroup> {

	private List<Annuaires> items = new ArrayList<Annuaires>();
	private String header;

	/**
	 * @param items
	 * @param header
	 */
	public AnnuaireGroup(String header, List<Annuaires> items) {
		Collections.sort(items);
		this.items = items;
		this.header = header;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	@Override
	public int compareTo(AnnuaireGroup another) {
		// TODO Auto-generated method stub
		return header.compareTo(another.header);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		AnnuaireGroup other = (AnnuaireGroup) obj;
		if (header == null) {
			if (other.header != null) {
				return false;
			}
		} else if (!header.equals(other.header)) {
			return false;
		}
		return true;
	}

	/**
	 * @return the header
	 */
	public String getHeader() {
		return header;
	}

	/**
	 * @return the items
	 */
	public List<Annuaires> getItems() {
		return items;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (header == null ? 0 : header.hashCode());
		return result;
	}

	/**
	 * @param header
	 *            the header to set
	 */
	public void setHeader(String header) {
		this.header = header;
	}

	/**
	 * @param items
	 *            the items to set
	 */
	public void setItems(List<Annuaires> items) {
		this.items = items;
	}

}
